<%@page import="org.lanqiao.dxzf.entity.Fee"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <link type="text/css" rel="stylesheet" media="all" href="${pageContext.request.contextPath}/css/global.css" />
        <link type="text/css" rel="stylesheet" media="all" href="${pageContext.request.contextPath}/css/global_color.css" />
        <script src="${pageContext.request.contextPath}/js/jquery.min.js" type="text/javascript"></script>
        <script language="javascript" type="text/javascript">
        	/* $(function() {
				$("#radios > input[name='radFeeType']").each(function() {
					if(${fee.fkind}=="包月"){
						
					}
				})
			}) */
            //保存结果的提示
            function showResult() {
                showResultDiv(true);
                window.setTimeout("showResultDiv(false);", 3000);
            }
            function showResultDiv(flag) {
                var divResult = document.getElementById("save_result_info");
                if (flag)
                    divResult.style.display = "block";
                else
                    divResult.style.display = "none";
            }

            //切换资费类型
            function feeTypeChange(type) {
                var inputArray = document.getElementById("main").getElementsByTagName("input");
                if (type == 1) {
                    inputArray[5].readonly = true;
                    inputArray[5].value = "";
                    inputArray[5].className += " readonly";
                    inputArray[6].readonly = false;
                    inputArray[6].className = "width100";
                    inputArray[7].readonly = true;
                    inputArray[7].className += " readonly";
                    inputArray[7].value = "";
                }
                else if (type == 2) {
                    inputArray[5].readonly = false;
                    inputArray[5].className = "width100";
                    inputArray[6].readonly = false;
                    inputArray[6].className = "width100";
                    inputArray[7].readonly = false;
                    inputArray[7].className = "width100";
                }
                else if (type == 3) {
                    inputArray[5].readonly = true;
                    inputArray[5].value = "";
                    inputArray[5].className += " readonly";
                    inputArray[6].readonly = true;
                    inputArray[6].value = "";
                    inputArray[6].className += " readonly";
                    inputArray[7].readonly = false;
                    inputArray[7].className = "width100";
                }
            }
            function radioValue() {
            	
            }
        </script>
    </head>
    <body>
        <!--Logo区域开始-->
        <%@include file="../include/header.jsp"%>
        <!--导航区域结束-->
        <!--主要区域开始-->
        <div id="main">            
            <div id="save_result_info" class="save_success">保存成功！</div>
            <form action="${pageContext.request.contextPath}/fee_modi_alter.do" method="post" class="main_form">
                <div class="text_info clearfix"><span>资费ID：</span></div>
                <div class="input_info"><input type="text" name="fid" class="readonly" readonly value="${fee.fid }" /></div>
                <div class="text_info clearfix"><span>资费名称：</span></div>
                <div class="input_info">
                    <input type="text" name="fname" class="width300" value="${fee.fname }"/>
                    <span class="required">*</span>
                    <div class="validate_msg_short">50长度的字母、数字、汉字和下划线的组合</div>
                </div>
                <div class="text_info clearfix"><span>资费类型：</span></div>
                <div class="input_info fee_type">
                    <%  Fee fee = (Fee)request.getAttribute("fee");
	                if("包月".equals(fee.getFkind())){ %>
	                    <input type="radio" name="fkind" checked="checked" id="monthly" onclick="feeTypeChange(1)" value="包月"/>
	                    <label for="monthly">包月</label>
	                    <input type="radio" name="fkind" id="package" onclick="feeTypeChange(2)" value="套餐"/>
	                    <label for="package">套餐</label>
	                    <input type="radio" name="fkind" id="timeBased" onclick="feeTypeChange(3)" value="计时"/>
	                    <label for="timeBased">计时</label>
	                <%}else if("套餐".equals(fee.getFkind())){ %>
	               		<input type="radio" name="fkind" id="monthly" onclick="feeTypeChange(1)" value="包月" />
	                    <label for="monthly">包月</label>
	                    <input type="radio" name="fkind" checked="checked" id="package" onclick="feeTypeChange(2)" value="套餐" />
	                    <label for="package">套餐</label>
	                    <input type="radio" name="fkind" id="timeBased" onclick="feeTypeChange(3)" value="计时" />
	                    <label for="timeBased">计时</label>
	                <%}else if("计时".equals(fee.getFkind())){%>
	                	<input type="radio" name="fkind" id="monthly" onclick="feeTypeChange(1)" value="包月" />
	                    <label for="monthly">包月</label>
	                    <input type="radio" name="fkind" id="package"  onclick="feeTypeChange(2)" value="套餐" />
	                    <label for="package">套餐</label>
	                    <input type="radio" name="fkind" checked="checked" id="timeBased" onclick="feeTypeChange(3)" value="计时" />
	                    <label for="timeBased">计时</label>
	                <%}else{ %>
	                	<input type="radio" name="fkind" id="monthly" onclick="feeTypeChange(1)" value="包月" />
	                    <label for="monthly">包月</label>
	                    <input type="radio" name="fkind" id="package" onclick="feeTypeChange(2)" value="套餐" />
	                    <label for="package">套餐</label>
	                    <input type="radio" name="fkind" id="timeBased" onclick="feeTypeChange(3)" value="计时" />
	                    <label for="timeBased">计时</label>
	                <%} %>
                </div>
                <input type="hidden" id="fkind" value="" />
                <div class="text_info clearfix"><span>基本时长：</span></div>
                <div class="input_info">
                    <input type="text" name="basic_time"  value="${fee.basic_time }" class="width100" />
                    <span class="info">小时</span>
                    <span class="required">*</span>
                    <div class="validate_msg_long">1-600之间的整数</div>
                </div>
                <div class="text_info clearfix"><span>基本费用：</span></div>
                <div class="input_info">
                    <input type="text" name="basic_price"  value="${fee.basic_price }" class="width100" />
                    <span class="info">元</span>
                    <span class="required">*</span>
                    <div class="validate_msg_long">0-99999.99之间的数值</div>
                </div>
                <div class="text_info clearfix"><span>单位费用：</span></div>
                <div class="input_info">
                    <input type="text" name="unit_price"  value="${fee.unit_price }" class="width100" />
                    <span class="info">元/小时</span>
                    <span class="required">*</span>
                    <div class="validate_msg_long">0-99999.99之间的数值</div>
                </div>   
                <div class="text_info clearfix"><span>资费说明：</span></div>
                <div class="input_info_high">
                    <textarea class="width300 height70" name="f_explain" >${fee.f_explain }
                    </textarea>
                    <div class="validate_msg_short">100长度的字母、数字、汉字和下划线的组合</div>
                </div>                    
                <div class="button_info clearfix">
                    <input type="submit" value="保存" class="btn_save"  onclick="showResult();" />
                    <input type="button" value="取消" class="btn_save" />
                </div>
            </form>
        </div>
        <!--主要区域结束-->
        <div id="footer">
            
        </div>
        <script type="text/javascript" language="javascript">
        //根据权限显示信息
        var listPrivs = "${sessionScope.listPrivs}";
        for(var p of listPrivs){
        if(p=="1")  {document.getElementById("p1").style.display="block";}
        if(p=="2")  {document.getElementById("p2").style.display="block";}
        if(p=="3")	{document.getElementById("p3").style.display="block";}
        if(p=="4")	{document.getElementById("p4").style.display="block";}
        if(p=="5")	{document.getElementById("p5").style.display="block";}
        if(p=="6")	{document.getElementById("p6").style.display="block";}
        if(p=="7")	{document.getElementById("p7").style.display="block";}
        }
		var update1 = null;
		update1 = '<%=request.getParameter("update")%>';
		if(update1=='yes'){
			alert("修改成功!");
		}
		if(update1=='no'){
			alert("修改失败!");
		}else{}
        </script>
    </body>
</html>
